<template>
	<view>
		<view class="avator">
			<image :src="filePath"></image>
		</view>
		<button @click="handleUploadImage">上传头像</button>
	</view>
</template>

<script>
	import CarMixins from '../../mixins/car-mixins.js'
	export default {
		mixins: [CarMixins],
		data() {
			return {
				filePath: '../../static/images/猫眼.png'
			};
		},
		methods: {
			handleUploadImage() {
				uni.chooseImage({
					count: 1,
					success: (result) => {
						const filePath = result.tempFilePaths[0];
						this.filePath = filePath
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.avator {
	width: 100rpx;
	height: 100rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
</style>
